package com.csi.bumblebee.domain.util;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.github.pagehelper.PageInfo;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * 返回结果载体
 *
 * @author HUOJT
 */
@Data
public class MyResult<T> implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 传递的数据
     */
    private T data;

    /**
     * 状态码
     */
    private Long code;

    /**
     * 分页信息
     */
    private PageInfo<T> pageInfo;

    /**
     * 状态信息
     */
    private String message;

    /**
     * 修改时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date time;

    public MyResult() {
        time = new Date();
    }

    public MyResult(Long code, String message) {
        this.code = code;
        this.message = message;
        this.time = new Date();
    }

    public MyResult(T o,Long code, String message) {
        this.code = code;
        this.message = message;
        this.data=o;
    }




}

